package entities;

import java.util.HashMap;
import java.util.Map;

public class Stock {

    private String stockName;
    private String enterpriseName_en;
    private String listing_market;
    private String listing_date;
    private String pulished_price;
    private String principal_underwriter;
    private String organization_type;
    private String secretary_of_board;
    private String secretary_contact;
    private String abbreviation_change_his;
    private String company_profile;

    public Stock(String stockName, String enterpriseName_en, String listing_market, String listing_date, String pulished_price, String principal_underwriter, String organization_type, String secretary_of_board, String secretary_contact, String abbreviation_change_his, String company_profile) {
        this.stockName = stockName;
        this.enterpriseName_en = enterpriseName_en;
        this.listing_market = listing_market;
        this.listing_date = listing_date;
        this.pulished_price = pulished_price;
        this.principal_underwriter = principal_underwriter;
        this.organization_type = organization_type;
        this.secretary_of_board = secretary_of_board;
        this.secretary_contact = secretary_contact;
        this.abbreviation_change_his = abbreviation_change_his != null ? abbreviation_change_his.trim() : null;
        this.company_profile = company_profile != null ? company_profile.trim() : null;
    }

    public Map<String, String> toMap(){
        Map<String, String> props = new HashMap<>();
        props.put("stockName", this.stockName);
        props.put("enterpriseName_en", this.enterpriseName_en);
        props.put("listing_market", this.listing_market);
        props.put("listing_date", this.listing_date);
        props.put("pulished_price", this.pulished_price);
        props.put("principal_underwriter", this.principal_underwriter);
        props.put("organization_type", this.organization_type);
        props.put("secretary_of_board", this.secretary_of_board);
        props.put("secretary_contact", this.secretary_contact);
        props.put("abbreviation_change_his", this.abbreviation_change_his);
        props.put("company_profile", this.company_profile);
        return props;
    }

    @Override
    public String toString() {
        return "Stock{" +
                "stockName: '" + stockName + '\'' +
                ", enterpriseName_en: '" + enterpriseName_en + '\'' +
                ", listing_market: '" + listing_market + '\'' +
                ", listing_date: '" + listing_date + '\'' +
                ", pulished_price: '" + pulished_price + '\'' +
                ", principal_underwriter: '" + principal_underwriter + '\'' +
                ", organization_type: '" + organization_type + '\'' +
                ", secretary_of_board: '" + secretary_of_board + '\'' +
                ", secretary_contact: '" + secretary_contact + '\'' +
                ", abbreviation_change_his: '" + abbreviation_change_his + '\'' +
                ", company_profile: '" + company_profile + '\'' +
                '}';
    }
}
